package com.youxin.busfoundation.enums;

import com.youxin.foundation.utils.StringUtils;

/**
 * 登陆类型,商理事,微信扫码登陆,微信公共平台登陆
 * @author yingde.cao
 *
 */
public enum LoginType {	
	MobileCode(1),
	UserNamePassword(2),
	WexinScanCode(3),
	WexinOpenType(4)
	;
	public int getValue() {
		return value;
	}
	private int value;
	private LoginType(int value) {
		this.value = value;
	}
	
	public static LoginType valueOf(int val)
	{			
		for(LoginType m : LoginType.values()) 
		{
			if(val==m.getValue())
				return m;
	    }
		return null;
	}
	
	public static LoginType nameOf(String val)
	{			
		if(StringUtils.isNullOrEmpty(val))
		{
			return null;
		}
		for(LoginType m : LoginType.values()) 
		{
			if(val.equalsIgnoreCase(m.name()))
				return m;
	    }
		return null;
	}
}
